import React, { useEffect,useState  } from 'react'
import Mytable from '../../components/Mytable'
import { Button, Form, Input} from 'antd';
import Styles from "./../../assets/styles/shoptype.module.less"
import {getAllCharge} from "../../apis/stores"
 

export default function Powerstation() {
  useEffect(()=>{
    fetchData()
  },[])
  const fetchData= async()=>{
    const res = await getAllCharge()
    setData(res.data.rows)
  }

  const [form] = Form.useForm();
  const [data,setData] = useState([])

  const onFinish = (values) => {
    console.log(values);
  };
  const columns=[
    {
      title: '充电桩名称',
      dataIndex: 'shopName',
    },
    {
      title: '电话',
      dataIndex: 'tel',
    },
    {
      title: '地址',
      dataIndex: 'address',
    },
    {
      title: '身份证号',
      dataIndex: 'idCard',
    },
    {
      title: '负责人',
      dataIndex: 'managerName',
    },
    {
      title: '执照号',
      dataIndex: 'licenceNo',
    },
    {
      title: '状态',
      dataIndex: 'status',
    },
    {
      title: '执照图片',
      dataIndex: 'shopName',
      render: (record) => <img src={record} alt="" width="50px"/>
    },
    {
      title: '操作',
      
    },
  ]
  return (
    <div>
      <div className={Styles.headerOne}>
        <Form form={form} name="horizontal_login" layout="inline" onFinish={onFinish}>
          <Form.Item
            name="name"
            label="名称"
          >
            <Input placeholder="" />
          </Form.Item>
          <Form.Item
            name="state"
            label="手机号"
            style={{ width: "300px" }}
          >
            <Input placeholder="" />

          </Form.Item>
          <Form.Item
            name="id"
            label="负责人"
            style={{ width: "300px" }}
          >
            <Input placeholder="" />

          </Form.Item>
          <div className={Styles.findOne} style={{marginLeft:100}}>
            <Form.Item shouldUpdate>
              {() => (
                <Button type="primary" htmlType="submit" className={Styles.find}>
                  查询
                </Button>
              )}
            </Form.Item>
            <Button className={Styles.findTwo}>重置</Button>
          </div>

        </Form>
      </div>
      <Mytable  columns={columns} data={data}></Mytable>
    </div>
  )
}
